using System; using System.Collections.Generic; using System.Linq; using System.Text; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Content; namespace SuperPolarity { static class ActorFactory { static internal SuperPolarity Game; static public MainShip CreateMainShip(Vector2 position) { MainShip mainShip = new MainShip(Game); mainShip.Initialize(Game.Content.Load("Graphics\\main-ship"), position); ActorManager.CheckIn(mainShip); return mainShip; } static public StandardShip CreateShip(Ship.Polarity polarity, Vector2 position) { StandardShip ship = new StandardShip(Game); Texture2D texture; if (polarity == Ship.Polarity.Positive) { texture = Game.Content.Load("Graphics\\positive-ship"); } else if (polarity == Ship.Polarity.Negative) { texture = Game.Content.Load("Graphics\\negative-ship"); } else { texture = Game.Content.Load("Graphics\\neutral-ship"); } ship.Initialize(texture, position); ship.SetPolarity(polarity); ActorManager.CheckIn(ship); return ship; } internal static void SetGame(SuperPolarity game) { ActorFactory.Game = game; } internal static Bullet CreateBullet(Vector2 position, float angle) { Bullet bullet = new Bullet(Game); bullet.Initialize(Game.Content.Load("Graphics\\square"), position); bullet.Angle = angle; ActorManager.CheckIn(bullet); return bullet; } } }